package com.yxt.toutiao.api.controller.admin;

import com.yxt.toutiao.api.common.Auth;
import com.yxt.toutiao.api.model.Category;
import com.yxt.toutiao.api.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(path = "v1/admin")
public class CategoryController {
	@Autowired
	private CategoryService categoryService;

	@Auth
	@GetMapping(value = "categories", produces = {MediaType.APPLICATION_JSON_VALUE})
	public ResponseEntity<List<Category>> getArticles() {
		//test git conflict another
		//test git conflict
		return new ResponseEntity<>(categoryService.findAll(), HttpStatus.OK);
	}

	@Auth
	@GetMapping(value = "categories/all", produces = {MediaType.APPLICATION_JSON_VALUE})
	public ResponseEntity<List<Category>> getAllArticles() {
		//update file in IDEA
		//update file in IDEA-2
		return new ResponseEntity<>(categoryService.findAll(), HttpStatus.OK);
	}

	//third update from git cli11111
	//third update from git cli22222
}
